package com.itcast.donkey.adapters;

import android.content.Context;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.TextView;

import com.itcast.donkey.R;

import java.util.List;

/**
 * Created by lanouhn on 16/9/9.
 */
public class PopLangueListAdapter extends BaseAdapter {
    private List<String> stringList;
    private Context context;

    public PopLangueListAdapter(List<String> stringList, Context context) {
        this.stringList = stringList;
        this.context = context;
    }

    @Override
    public int getCount() {
        return stringList.size();
    }

    @Override
    public Object getItem(int position) {
        return stringList.get(position);
    }

    @Override
    public long getItemId(int position) {
        return position;
    }

    @Override
    public View getView(int position, View convertView, ViewGroup parent) {
        convertView = View.inflate(context, R.layout.item_pop_langue_list, null);
        TextView tv = (TextView) convertView.findViewById(R.id.tv_item_langue);
        tv.setText(stringList.get(position));
        return convertView;
    }
}
